/*
 * CouponDeprecatedHolder.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.viewholder;

import android.view.View;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Coupon;
import com.yidiandao.business.ui.widget.listview.ViewHolder;
import com.yidiandao.business.ui.widget.view.RedPacketLayout;

import java.util.List;

/** 已过期红包 item ViewHolder */
public class CouponDeprecatedHolder extends ViewHolder {

    private RedPacketLayout redPacketLayout;

    @Override
    protected void initView(View rootView) {
        redPacketLayout = (RedPacketLayout) rootView.findViewById(R.id.red_packet_layout);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_coupon_deprecated;
    }

    public void refreshUI(Coupon coupon) {
        redPacketLayout.setTipStatus(false, false);
        String bonusName = coupon.getBonusName();
        String money = coupon.getMoney() + "";
        List<String> exp = coupon.getExp();

        try {
            redPacketLayout.setRedPacketData(money, bonusName, exp.get(0), exp.get(1), exp.get(2));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
